libxc: finalise transition to hypercall buffers.
authorIan Campbell <ian.campbell@citrix.com>
Fri, 22 Oct 2010 14:14:51 +0000 (15:14 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Fri, 22 Oct 2010 14:14:51 +0000 (15:14 +0100)
Rename xc_set_xen_guest_handle to set_xen_guest_handle[0] and remove now
unused functions:
  - xc_memalign
  - lock_pages
  - unlock_pages
  - hcall_buf_prep
  - hcall_buf_release

[0] sed -i -e 's/xc_set_xen_guest_handle/set_xen_guest_handle/g' \
tools/libxc/*.[ch] \
tools/python/xen/lowlevel/xc/xc.c \
tools/python/xen/lowlevel/acm/acm.c \
tools/libxc/ia64/xc_ia64_stubs.c \
tools/security/secpol_tool.c \
tools/misc/xenpm.c

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
17 files changed:
tools/libxc/xc_cpupool.c
tools/libxc/xc_dom_boot.c
tools/libxc/xc_domain.c
tools/libxc/xc_domain_restore.c
tools/libxc/xc_linux.c
tools/libxc/xc_misc.c
tools/libxc/xc_offline_page.c
tools/libxc/xc_pm.c
tools/libxc/xc_private.c
tools/libxc/xc_private.h
tools/libxc/xc_tbuf.c
tools/libxc/xc_tmem.c
tools/libxc/xenctrl.h
tools/misc/xenpm.c
tools/python/xen/lowlevel/acm/acm.c
tools/python/xen/lowlevel/xc/xc.c
tools/security/secpol_tool.c

index 630ed0628c051fa3a72fa0b24364cd1d448c8c20..c2f6c6838ff5651ff7ace6aa1c2d0950c26ff6eb 100644 (file)
@@ -99,7 +99,7 @@ xc_cpupoolinfo_t *xc_cpupool_getinfo(xc_interface *xch,
     sysctl.cmd = XEN_SYSCTL_cpupool_op;
     sysctl.u.cpupool_op.op = XEN_SYSCTL_CPUPOOL_OP_INFO;
     sysctl.u.cpupool_op.cpupool_id = poolid;
-    xc_set_xen_guest_handle(sysctl.u.cpupool_op.cpumap.bitmap, local);
+    set_xen_guest_handle(sysctl.u.cpupool_op.cpumap.bitmap, local);
     sysctl.u.cpupool_op.cpumap.nr_cpus = local_size * 8;
 
     err = do_sysctl_save(xch, &sysctl);
@@ -185,7 +185,7 @@ uint64_t * xc_cpupool_freeinfo(xc_interface *xch,
 
     sysctl.cmd = XEN_SYSCTL_cpupool_op;
     sysctl.u.cpupool_op.op = XEN_SYSCTL_CPUPOOL_OP_FREEINFO;
-    xc_set_xen_guest_handle(sysctl.u.cpupool_op.cpumap.bitmap, local);
+    set_xen_guest_handle(sysctl.u.cpupool_op.cpumap.bitmap, local);
     sysctl.u.cpupool_op.cpumap.nr_cpus = *cpusize * 8;
 
     err = do_sysctl_save(xch, &sysctl);
index 28698a3827bc155c617d5be9bd0917db29903cd8..65f60df32fd46cbc5e2fdb9b7f24cda557cac733 100644 (file)
@@ -72,7 +72,7 @@ static int launch_vm(xc_interface *xch, domid_t domid, xc_hypercall_buffer_t *ct
     domctl.cmd = XEN_DOMCTL_setvcpucontext;
     domctl.domain = domid;
     domctl.u.vcpucontext.vcpu = 0;
-    xc_set_xen_guest_handle(domctl.u.vcpucontext.ctxt, ctxt);
+    set_xen_guest_handle(domctl.u.vcpucontext.ctxt, ctxt);
     rc = do_domctl(xch, &domctl);
     if ( rc != 0 )
         xc_dom_panic(xch, XC_INTERNAL_ERROR,
index 329735ebedcc502cf278fdba2ed80e58c3dae4a8..6bb2fa5eed57e912b34a04f2cdfd8a7ea73f93bc 100644 (file)
@@ -132,7 +132,7 @@ int xc_vcpu_setaffinity(xc_interface *xch,
 
     bitmap_64_to_byte(local, cpumap, cpusize * 8);
 
-    xc_set_xen_guest_handle(domctl.u.vcpuaffinity.cpumap.bitmap, local);
+    set_xen_guest_handle(domctl.u.vcpuaffinity.cpumap.bitmap, local);
 
     domctl.u.vcpuaffinity.cpumap.nr_cpus = cpusize * 8;
 
@@ -165,7 +165,7 @@ int xc_vcpu_getaffinity(xc_interface *xch,
     domctl.domain = (domid_t)domid;
     domctl.u.vcpuaffinity.vcpu = vcpu;
 
-    xc_set_xen_guest_handle(domctl.u.vcpuaffinity.cpumap.bitmap, local);
+    set_xen_guest_handle(domctl.u.vcpuaffinity.cpumap.bitmap, local);
     domctl.u.vcpuaffinity.cpumap.nr_cpus = cpusize * 8;
 
     ret = do_domctl(xch, &domctl);
@@ -254,7 +254,7 @@ int xc_domain_getinfolist(xc_interface *xch,
     sysctl.cmd = XEN_SYSCTL_getdomaininfolist;
     sysctl.u.getdomaininfolist.first_domain = first_domain;
     sysctl.u.getdomaininfolist.max_domains  = max_domains;
-    xc_set_xen_guest_handle(sysctl.u.getdomaininfolist.buffer, info);
+    set_xen_guest_handle(sysctl.u.getdomaininfolist.buffer, info);
 
     if ( xc_sysctl(xch, &sysctl) < 0 )
         ret = -1;
@@ -282,7 +282,7 @@ int xc_domain_hvm_getcontext(xc_interface *xch,
     domctl.cmd = XEN_DOMCTL_gethvmcontext;
     domctl.domain = (domid_t)domid;
     domctl.u.hvmcontext.size = size;
-    xc_set_xen_guest_handle(domctl.u.hvmcontext.buffer, ctxt_buf);
+    set_xen_guest_handle(domctl.u.hvmcontext.buffer, ctxt_buf);
 
     ret = do_domctl(xch, &domctl);
 
@@ -311,7 +311,7 @@ int xc_domain_hvm_getcontext_partial(xc_interface *xch,
     domctl.domain = (domid_t) domid;
     domctl.u.hvmcontext_partial.type = typecode;
     domctl.u.hvmcontext_partial.instance = instance;
-    xc_set_xen_guest_handle(domctl.u.hvmcontext_partial.buffer, ctxt_buf);
+    set_xen_guest_handle(domctl.u.hvmcontext_partial.buffer, ctxt_buf);
 
     ret = do_domctl(xch, &domctl);
 
@@ -337,7 +337,7 @@ int xc_domain_hvm_setcontext(xc_interface *xch,
     domctl.cmd = XEN_DOMCTL_sethvmcontext;
     domctl.domain = domid;
     domctl.u.hvmcontext.size = size;
-    xc_set_xen_guest_handle(domctl.u.hvmcontext.buffer, ctxt_buf);
+    set_xen_guest_handle(domctl.u.hvmcontext.buffer, ctxt_buf);
 
     ret = do_domctl(xch, &domctl);
 
@@ -361,7 +361,7 @@ int xc_vcpu_getcontext(xc_interface *xch,
     domctl.cmd = XEN_DOMCTL_getvcpucontext;
     domctl.domain = (domid_t)domid;
     domctl.u.vcpucontext.vcpu   = (uint16_t)vcpu;
-    xc_set_xen_guest_handle(domctl.u.vcpucontext.ctxt, ctxt);
+    set_xen_guest_handle(domctl.u.vcpucontext.ctxt, ctxt);
 
     rc = do_domctl(xch, &domctl);
 
@@ -420,7 +420,7 @@ int xc_shadow_control(xc_interface *xch,
     domctl.u.shadow_op.mb     = mb ? *mb : 0;
     domctl.u.shadow_op.mode   = mode;
     if (dirty_bitmap != NULL)
-        xc_set_xen_guest_handle(domctl.u.shadow_op.dirty_bitmap,
+        set_xen_guest_handle(domctl.u.shadow_op.dirty_bitmap,
                                 dirty_bitmap);
 
     rc = do_domctl(xch, &domctl);
@@ -486,7 +486,7 @@ int xc_domain_set_memmap_limit(xc_interface *xch,
     e820->size = (uint64_t)map_limitkb << 10;
     e820->type = E820_RAM;
 
-    xc_set_xen_guest_handle(fmap.map.buffer, e820);
+    set_xen_guest_handle(fmap.map.buffer, e820);
 
     rc = do_memory_op(xch, XENMEM_set_memory_map, &fmap, sizeof(fmap));
 
@@ -559,7 +559,7 @@ int xc_domain_get_tsc_info(xc_interface *xch,
 
     domctl.cmd = XEN_DOMCTL_gettscinfo;
     domctl.domain = (domid_t)domid;
-    xc_set_xen_guest_handle(domctl.u.tsc_info.out_info, info);
+    set_xen_guest_handle(domctl.u.tsc_info.out_info, info);
     rc = do_domctl(xch, &domctl);
     if ( rc == 0 )
     {
@@ -601,7 +601,7 @@ int xc_domain_increase_reservation(xc_interface *xch,
         return -1;
     }
 
-    xc_set_xen_guest_handle(reservation.extent_start, extent_start);
+    set_xen_guest_handle(reservation.extent_start, extent_start);
 
     err = do_memory_op(xch, XENMEM_increase_reservation, &reservation, sizeof(reservation));
 
@@ -664,7 +664,7 @@ int xc_domain_decrease_reservation(xc_interface *xch,
         PERROR("Could not bounce memory for XENMEM_decrease_reservation hypercall");
         return -1;
     }
-    xc_set_xen_guest_handle(reservation.extent_start, extent_start);
+    set_xen_guest_handle(reservation.extent_start, extent_start);
 
     err = do_memory_op(xch, XENMEM_decrease_reservation, &reservation, sizeof(reservation));
 
@@ -734,7 +734,7 @@ int xc_domain_populate_physmap(xc_interface *xch,
         PERROR("Could not bounce memory for XENMEM_populate_physmap hypercall");
         return -1;
     }
-    xc_set_xen_guest_handle(reservation.extent_start, extent_start);
+    set_xen_guest_handle(reservation.extent_start, extent_start);
 
     err = do_memory_op(xch, XENMEM_populate_physmap, &reservation, sizeof(reservation));
 
@@ -796,8 +796,8 @@ int xc_domain_memory_exchange_pages(xc_interface *xch,
          xc_hypercall_bounce_pre(xch, out_extents))
         goto out;
 
-    xc_set_xen_guest_handle(exchange.in.extent_start, in_extents);
-    xc_set_xen_guest_handle(exchange.out.extent_start, out_extents);
+    set_xen_guest_handle(exchange.in.extent_start, in_extents);
+    set_xen_guest_handle(exchange.out.extent_start, out_extents);
 
     rc = do_memory_op(xch, XENMEM_exchange, &exchange, sizeof(exchange));
 
@@ -976,7 +976,7 @@ int xc_vcpu_setcontext(xc_interface *xch,
     domctl.cmd = XEN_DOMCTL_setvcpucontext;
     domctl.domain = domid;
     domctl.u.vcpucontext.vcpu = vcpu;
-    xc_set_xen_guest_handle(domctl.u.vcpucontext.ctxt, ctxt);
+    set_xen_guest_handle(domctl.u.vcpucontext.ctxt, ctxt);
 
     rc = do_domctl(xch, &domctl);
 
@@ -1124,7 +1124,7 @@ int xc_get_device_group(
     domctl.u.get_device_group.machine_bdf = machine_bdf;
     domctl.u.get_device_group.max_sdevs = max_sdevs;
 
-    xc_set_xen_guest_handle(domctl.u.get_device_group.sdev_array, sdev_array);
+    set_xen_guest_handle(domctl.u.get_device_group.sdev_array, sdev_array);
 
     rc = do_domctl(xch, &domctl);
 
index 5ac2de5445e94be1f9ab3b37066619f3a7d1488e..c9f3916b34ec77b2d97d6f3df34fd85c38b99b86 100644 (file)
@@ -1639,7 +1639,7 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom,
         domctl.cmd = XEN_DOMCTL_setvcpucontext;
         domctl.domain = (domid_t)dom;
         domctl.u.vcpucontext.vcpu = i;
-        xc_set_xen_guest_handle(domctl.u.vcpucontext.ctxt, ctxt);
+        set_xen_guest_handle(domctl.u.vcpucontext.ctxt, ctxt);
         frc = xc_domctl(xch, &domctl);
         if ( frc != 0 )
         {
index ead6b31f90e3c8a20e518159bfcf9526fd401cae..5635e2b78185cec1151f2aee239553fb8b16ab12 100644 (file)
@@ -686,7 +686,7 @@ static void *_gnttab_map_table(xc_interface *xch, int domid, int *gnt_num)
 
     setup.dom = domid;
     setup.nr_frames = query.nr_frames;
-    xc_set_xen_guest_handle(setup.frame_list, frame_list);
+    set_xen_guest_handle(setup.frame_list, frame_list);
 
     /* XXX Any race with other setup_table hypercall? */
     rc = xc_gnttab_op(xch, GNTTABOP_setup_table, &setup, sizeof(setup),
index 6995dcc4cdd47b99e3c8171cc93e33176aa64365..1707b997e1108f2454c60a6cfba43925b13f22c7 100644 (file)
@@ -49,7 +49,7 @@ int xc_readconsolering(xc_interface *xch,
         return -1;
 
     sysctl.cmd = XEN_SYSCTL_readconsole;
-    xc_set_xen_guest_handle(sysctl.u.readconsole.buffer, buffer);
+    set_xen_guest_handle(sysctl.u.readconsole.buffer, buffer);
     sysctl.u.readconsole.count = nr_chars;
     sysctl.u.readconsole.clear = clear;
     sysctl.u.readconsole.incremental = 0;
@@ -81,7 +81,7 @@ int xc_send_debug_keys(xc_interface *xch, char *keys)
         return -1;
 
     sysctl.cmd = XEN_SYSCTL_debug_keys;
-    xc_set_xen_guest_handle(sysctl.u.debug_keys.keys, keys);
+    set_xen_guest_handle(sysctl.u.debug_keys.keys, keys);
     sysctl.u.debug_keys.nr_keys = len;
 
     ret = do_sysctl(xch, &sysctl);
@@ -190,8 +190,8 @@ int xc_perfc_reset(xc_interface *xch)
 
     sysctl.cmd = XEN_SYSCTL_perfc_op;
     sysctl.u.perfc_op.cmd = XEN_SYSCTL_PERFCOP_reset;
-    xc_set_xen_guest_handle(sysctl.u.perfc_op.desc, HYPERCALL_BUFFER_NULL);
-    xc_set_xen_guest_handle(sysctl.u.perfc_op.val, HYPERCALL_BUFFER_NULL);
+    set_xen_guest_handle(sysctl.u.perfc_op.desc, HYPERCALL_BUFFER_NULL);
+    set_xen_guest_handle(sysctl.u.perfc_op.val, HYPERCALL_BUFFER_NULL);
 
     return do_sysctl(xch, &sysctl);
 }
@@ -205,8 +205,8 @@ int xc_perfc_query_number(xc_interface *xch,
 
     sysctl.cmd = XEN_SYSCTL_perfc_op;
     sysctl.u.perfc_op.cmd = XEN_SYSCTL_PERFCOP_query;
-    xc_set_xen_guest_handle(sysctl.u.perfc_op.desc, HYPERCALL_BUFFER_NULL);
-    xc_set_xen_guest_handle(sysctl.u.perfc_op.val, HYPERCALL_BUFFER_NULL);
+    set_xen_guest_handle(sysctl.u.perfc_op.desc, HYPERCALL_BUFFER_NULL);
+    set_xen_guest_handle(sysctl.u.perfc_op.val, HYPERCALL_BUFFER_NULL);
 
     rc = do_sysctl(xch, &sysctl);
 
@@ -228,8 +228,8 @@ int xc_perfc_query(xc_interface *xch,
 
     sysctl.cmd = XEN_SYSCTL_perfc_op;
     sysctl.u.perfc_op.cmd = XEN_SYSCTL_PERFCOP_query;
-    xc_set_xen_guest_handle(sysctl.u.perfc_op.desc, desc);
-    xc_set_xen_guest_handle(sysctl.u.perfc_op.val, val);
+    set_xen_guest_handle(sysctl.u.perfc_op.desc, desc);
+    set_xen_guest_handle(sysctl.u.perfc_op.val, val);
 
     return do_sysctl(xch, &sysctl);
 }
@@ -240,7 +240,7 @@ int xc_lockprof_reset(xc_interface *xch)
 
     sysctl.cmd = XEN_SYSCTL_lockprof_op;
     sysctl.u.lockprof_op.cmd = XEN_SYSCTL_LOCKPROF_reset;
-    xc_set_xen_guest_handle(sysctl.u.lockprof_op.data, HYPERCALL_BUFFER_NULL);
+    set_xen_guest_handle(sysctl.u.lockprof_op.data, HYPERCALL_BUFFER_NULL);
 
     return do_sysctl(xch, &sysctl);
 }
@@ -253,7 +253,7 @@ int xc_lockprof_query_number(xc_interface *xch,
 
     sysctl.cmd = XEN_SYSCTL_lockprof_op;
     sysctl.u.lockprof_op.cmd = XEN_SYSCTL_LOCKPROF_query;
-    xc_set_xen_guest_handle(sysctl.u.lockprof_op.data, HYPERCALL_BUFFER_NULL);
+    set_xen_guest_handle(sysctl.u.lockprof_op.data, HYPERCALL_BUFFER_NULL);
 
     rc = do_sysctl(xch, &sysctl);
 
@@ -274,7 +274,7 @@ int xc_lockprof_query(xc_interface *xch,
     sysctl.cmd = XEN_SYSCTL_lockprof_op;
     sysctl.u.lockprof_op.cmd = XEN_SYSCTL_LOCKPROF_query;
     sysctl.u.lockprof_op.max_elem = *n_elems;
-    xc_set_xen_guest_handle(sysctl.u.lockprof_op.data, data);
+    set_xen_guest_handle(sysctl.u.lockprof_op.data, data);
 
     rc = do_sysctl(xch, &sysctl);
 
@@ -295,7 +295,7 @@ int xc_getcpuinfo(xc_interface *xch, int max_cpus,
 
     sysctl.cmd = XEN_SYSCTL_getcpuinfo;
     sysctl.u.getcpuinfo.max_cpus = max_cpus;
-    xc_set_xen_guest_handle(sysctl.u.getcpuinfo.info, info);
+    set_xen_guest_handle(sysctl.u.getcpuinfo.info, info);
 
     rc = do_sysctl(xch, &sysctl);
 
@@ -427,7 +427,7 @@ int xc_hvm_track_dirty_vram(
     arg->domid     = dom;
     arg->first_pfn = first_pfn;
     arg->nr        = nr;
-    xc_set_xen_guest_handle(arg->dirty_bitmap, dirty_bitmap);
+    set_xen_guest_handle(arg->dirty_bitmap, dirty_bitmap);
 
     rc = do_xen_hypercall(xch, &hypercall);
 
index b5335860999599ec72e00af853c6ab710542e6c0..ad8e24cf3737d4040a40fefa99c229ed9751c564 100644 (file)
@@ -82,7 +82,7 @@ int xc_mark_page_online(xc_interface *xch, unsigned long start,
     sysctl.u.page_offline.start = start;
     sysctl.u.page_offline.cmd = sysctl_page_online;
     sysctl.u.page_offline.end = end;
-    xc_set_xen_guest_handle(sysctl.u.page_offline.status, status);
+    set_xen_guest_handle(sysctl.u.page_offline.status, status);
     ret = xc_sysctl(xch, &sysctl);
 
     xc_hypercall_bounce_post(xch, status);
@@ -110,7 +110,7 @@ int xc_mark_page_offline(xc_interface *xch, unsigned long start,
     sysctl.u.page_offline.start = start;
     sysctl.u.page_offline.cmd = sysctl_page_offline;
     sysctl.u.page_offline.end = end;
-    xc_set_xen_guest_handle(sysctl.u.page_offline.status, status);
+    set_xen_guest_handle(sysctl.u.page_offline.status, status);
     ret = xc_sysctl(xch, &sysctl);
 
     xc_hypercall_bounce_post(xch, status);
@@ -138,7 +138,7 @@ int xc_query_page_offline_status(xc_interface *xch, unsigned long start,
     sysctl.u.page_offline.start = start;
     sysctl.u.page_offline.cmd = sysctl_query_page_offline;
     sysctl.u.page_offline.end = end;
-    xc_set_xen_guest_handle(sysctl.u.page_offline.status, status);
+    set_xen_guest_handle(sysctl.u.page_offline.status, status);
     ret = xc_sysctl(xch, &sysctl);
 
     xc_hypercall_bounce_post(xch, status);
index 36e0a9fa08be575aa2284576a08146b991144167..fd88c38b1f01e88457ac3cd1b059eb5afbbde5d2 100644 (file)
@@ -73,8 +73,8 @@ int xc_pm_get_pxstat(xc_interface *xch, int cpuid, struct xc_px_stat *pxpt)
     sysctl.u.get_pmstat.type = PMSTAT_get_pxstat;
     sysctl.u.get_pmstat.cpuid = cpuid;
     sysctl.u.get_pmstat.u.getpx.total = max_px;
-    xc_set_xen_guest_handle(sysctl.u.get_pmstat.u.getpx.trans_pt, trans);
-    xc_set_xen_guest_handle(sysctl.u.get_pmstat.u.getpx.pt, pt);
+    set_xen_guest_handle(sysctl.u.get_pmstat.u.getpx.trans_pt, trans);
+    set_xen_guest_handle(sysctl.u.get_pmstat.u.getpx.pt, pt);
 
     ret = xc_sysctl(xch, &sysctl);
     if ( ret )
@@ -146,8 +146,8 @@ int xc_pm_get_cxstat(xc_interface *xch, int cpuid, struct xc_cx_stat *cxpt)
     sysctl.cmd = XEN_SYSCTL_get_pmstat;
     sysctl.u.get_pmstat.type = PMSTAT_get_cxstat;
     sysctl.u.get_pmstat.cpuid = cpuid;
-    xc_set_xen_guest_handle(sysctl.u.get_pmstat.u.getcx.triggers, triggers);
-    xc_set_xen_guest_handle(sysctl.u.get_pmstat.u.getcx.residencies, residencies);
+    set_xen_guest_handle(sysctl.u.get_pmstat.u.getcx.triggers, triggers);
+    set_xen_guest_handle(sysctl.u.get_pmstat.u.getcx.residencies, residencies);
 
     if ( (ret = xc_sysctl(xch, &sysctl)) )
         goto unlock_2;
@@ -219,9 +219,9 @@ int xc_get_cpufreq_para(xc_interface *xch, int cpuid,
         if ( xc_hypercall_bounce_pre(xch, scaling_available_governors) )
             goto unlock_3;
 
-        xc_set_xen_guest_handle(sys_para->affected_cpus, affected_cpus);
-        xc_set_xen_guest_handle(sys_para->scaling_available_frequencies, scaling_available_frequencies);
-        xc_set_xen_guest_handle(sys_para->scaling_available_governors, scaling_available_governors);
+        set_xen_guest_handle(sys_para->affected_cpus, affected_cpus);
+        set_xen_guest_handle(sys_para->scaling_available_frequencies, scaling_available_frequencies);
+        set_xen_guest_handle(sys_para->scaling_available_governors, scaling_available_governors);
     }
 
     sysctl.cmd = XEN_SYSCTL_pm_op;
index 266a7c078feae47d8356e619a478909ce29ce487..9e0d3ce2db7ffe6e863d26ee19c554bafeedb0d9 100644 (file)
@@ -69,8 +69,6 @@ xc_interface *xc_interface_open(xentoollog_logger *logger,
     return 0;
 }
 
-static void xc_clean_hcall_buf(xc_interface *xch);
-
 int xc_interface_close(xc_interface *xch)
 {
     int rc = 0;
@@ -83,8 +81,6 @@ int xc_interface_close(xc_interface *xch)
         if (rc) PERROR("Could not close hypervisor interface");
     }
 
-    xc_clean_hcall_buf(xch);
-
     free(xch);
     return rc;
 }
@@ -189,133 +185,6 @@ void xc_report_progress_step(xc_interface *xch,
                  done, total);
 }
 
-#ifdef __sun__
-
-int lock_pages(xc_interface *xch, void *addr, size_t len) { return 0; }
-void unlock_pages(xc_interface *xch, void *addr, size_t len) { }
-
-int hcall_buf_prep(xc_interface *xch, void **addr, size_t len) { return 0; }
-void hcall_buf_release(xc_interface *xch, void **addr, size_t len) { }
-
-static void xc_clean_hcall_buf(xc_interface *xch) { }
-
-#else /* !__sun__ */
-
-int lock_pages(xc_interface *xch, void *addr, size_t len)
-{
-      int e;
-      void *laddr = (void *)((unsigned long)addr & PAGE_MASK);
-      size_t llen = (len + ((unsigned long)addr - (unsigned long)laddr) +
-                     PAGE_SIZE - 1) & PAGE_MASK;
-      e = mlock(laddr, llen);
-      return e;
-}
-
-void unlock_pages(xc_interface *xch, void *addr, size_t len)
-{
-    void *laddr = (void *)((unsigned long)addr & PAGE_MASK);
-    size_t llen = (len + ((unsigned long)addr - (unsigned long)laddr) +
-                   PAGE_SIZE - 1) & PAGE_MASK;
-    int saved_errno = errno;
-    (void)munlock(laddr, llen);
-    errno = saved_errno;
-}
-
-static pthread_key_t hcall_buf_pkey;
-static pthread_once_t hcall_buf_pkey_once = PTHREAD_ONCE_INIT;
-struct hcall_buf {
-    xc_interface *xch;
-    void *buf;
-    void *oldbuf;
-};
-
-static void _xc_clean_hcall_buf(void *m)
-{
-    struct hcall_buf *hcall_buf = m;
-
-    if ( hcall_buf )
-    {
-        if ( hcall_buf->buf )
-        {
-            unlock_pages(hcall_buf->xch, hcall_buf->buf, PAGE_SIZE);
-            free(hcall_buf->buf);
-        }
-
-        free(hcall_buf);
-    }
-
-    pthread_setspecific(hcall_buf_pkey, NULL);
-}
-
-static void _xc_init_hcall_buf(void)
-{
-    pthread_key_create(&hcall_buf_pkey, _xc_clean_hcall_buf);
-}
-
-static void xc_clean_hcall_buf(xc_interface *xch)
-{
-    pthread_once(&hcall_buf_pkey_once, _xc_init_hcall_buf);
-
-    _xc_clean_hcall_buf(pthread_getspecific(hcall_buf_pkey));
-}
-
-int hcall_buf_prep(xc_interface *xch, void **addr, size_t len)
-{
-    struct hcall_buf *hcall_buf;
-
-    pthread_once(&hcall_buf_pkey_once, _xc_init_hcall_buf);
-
-    hcall_buf = pthread_getspecific(hcall_buf_pkey);
-    if ( !hcall_buf )
-    {
-        hcall_buf = calloc(1, sizeof(*hcall_buf));
-        if ( !hcall_buf )
-            goto out;
-        hcall_buf->xch = xch;
-        pthread_setspecific(hcall_buf_pkey, hcall_buf);
-    }
-
-    if ( !hcall_buf->buf )
-    {
-        hcall_buf->buf = xc_memalign(PAGE_SIZE, PAGE_SIZE);
-        if ( !hcall_buf->buf || lock_pages(xch, hcall_buf->buf, PAGE_SIZE) )
-        {
-            free(hcall_buf->buf);
-            hcall_buf->buf = NULL;
-            goto out;
-        }
-    }
-
-    if ( (len < PAGE_SIZE) && !hcall_buf->oldbuf )
-    {
-        memcpy(hcall_buf->buf, *addr, len);
-        hcall_buf->oldbuf = *addr;
-        *addr = hcall_buf->buf;
-        return 0;
-    }
-
- out:
-    return lock_pages(xch, *addr, len);
-}
-
-void hcall_buf_release(xc_interface *xch, void **addr, size_t len)
-{
-    struct hcall_buf *hcall_buf = pthread_getspecific(hcall_buf_pkey);
-
-    if ( hcall_buf && (hcall_buf->buf == *addr) )
-    {
-        memcpy(hcall_buf->oldbuf, *addr, len);
-        *addr = hcall_buf->oldbuf;
-        hcall_buf->oldbuf = NULL;
-    }
-    else
-    {
-        unlock_pages(xch, *addr, len);
-    }
-}
-
-#endif
-
 /* NB: arr must be locked */
 int xc_get_pfn_type_batch(xc_interface *xch, uint32_t dom,
                           unsigned int num, xen_pfn_t *arr)
@@ -328,7 +197,7 @@ int xc_get_pfn_type_batch(xc_interface *xch, uint32_t dom,
     domctl.cmd = XEN_DOMCTL_getpageframeinfo3;
     domctl.domain = (domid_t)dom;
     domctl.u.getpageframeinfo3.num = num;
-    xc_set_xen_guest_handle(domctl.u.getpageframeinfo3.array, arr);
+    set_xen_guest_handle(domctl.u.getpageframeinfo3.array, arr);
     rc = do_domctl(xch, &domctl);
     xc_hypercall_bounce_post(xch, arr);
     return rc;
@@ -486,7 +355,7 @@ int xc_machphys_mfn_list(xc_interface *xch,
         return -1;
     }
 
-    xc_set_xen_guest_handle(xmml.extent_start, extent_start);
+    set_xen_guest_handle(xmml.extent_start, extent_start);
     rc = do_memory_op(xch, XENMEM_machphys_mfn_list, &xmml, sizeof(xmml));
     if (rc || xmml.nr_extents != max_extents)
         rc = -1;
@@ -520,7 +389,7 @@ int xc_get_pfn_list(xc_interface *xch,
     domctl.cmd = XEN_DOMCTL_getmemlist;
     domctl.domain   = (domid_t)domid;
     domctl.u.getmemlist.max_pfns = max_pfns;
-    xc_set_xen_guest_handle(domctl.u.getmemlist.buffer, pfn_buf);
+    set_xen_guest_handle(domctl.u.getmemlist.buffer, pfn_buf);
 
     ret = do_domctl(xch, &domctl);
 
@@ -780,22 +649,6 @@ int xc_ffs64(uint64_t x)
     return l ? xc_ffs32(l) : h ? xc_ffs32(h) + 32 : 0;
 }
 
-void *xc_memalign(size_t alignment, size_t size)
-{
-#if defined(_POSIX_C_SOURCE) && !defined(__sun__)
-    int ret;
-    void *ptr;
-    ret = posix_memalign(&ptr, alignment, size);
-    if (ret != 0)
-        return NULL;
-    return ptr;
-#elif defined(__NetBSD__) || defined(__OpenBSD__)
-    return valloc(size);
-#else
-    return memalign(alignment, size);
-#endif
-}
-
 /*
  * Local variables:
  * mode: C
index c56348e4e6111f35ee54709da928a9fae0464e71..e07a55b75d18d7083c8d0e85ea3ebca3240a15bb 100644 (file)
@@ -98,14 +98,6 @@ void xc_report_progress_step(xc_interface *xch,
 #define PERROR(_m, _a...) xc_report_error(xch,XC_INTERNAL_ERROR,_m \
                   " (%d = %s)", ## _a , errno, safe_strerror(errno))
 
-void *xc_memalign(size_t alignment, size_t size);
-
-int lock_pages(xc_interface *xch, void *addr, size_t len);
-void unlock_pages(xc_interface *xch, void *addr, size_t len);
-
-int hcall_buf_prep(xc_interface *xch, void **addr, size_t len);
-void hcall_buf_release(xc_interface *xch, void **addr, size_t len);
-
 /*
  * HYPERCALL ARGUMENT BUFFERS
  *
index 4ea239bb0b0d6c86ecfaa1bae7440f67c62919c2..5f91b6eeef8670e5d2a569e243b0d1a71340aada 100644 (file)
@@ -132,7 +132,7 @@ int xc_tbuf_set_cpu_mask(xc_interface *xch, uint32_t mask)
 
     bitmap_64_to_byte(bytemap, &mask64, sizeof (mask64) * 8);
 
-    xc_set_xen_guest_handle(sysctl.u.tbuf_op.cpu_mask.bitmap, bytemap);
+    set_xen_guest_handle(sysctl.u.tbuf_op.cpu_mask.bitmap, bytemap);
     sysctl.u.tbuf_op.cpu_mask.nr_cpus = sizeof(bytemap) * 8;
 
     ret = do_sysctl(xch, &sysctl);
index f02bc6697b86de02a2668ee446d6b237fe797921..019050cb974303e4762b4f9e11d9e97cd6649eb6 100644 (file)
@@ -86,7 +86,7 @@ int xc_tmem_control(xc_interface *xch,
         }
     }
 
-    xc_set_xen_guest_handle(op.u.ctrl.buf, buf);
+    set_xen_guest_handle(op.u.ctrl.buf, buf);
 
     rc = do_tmem_op(xch, &op);
 
@@ -136,7 +136,7 @@ int xc_tmem_control_oid(xc_interface *xch,
         }
     }
 
-    xc_set_xen_guest_handle(op.u.ctrl.buf, buf);
+    set_xen_guest_handle(op.u.ctrl.buf, buf);
 
     rc = do_tmem_op(xch, &op);
 
index 4454d4c4a288be8c47475ae53d69404e2273b3f1..43b2d0b6f65a07893d1b71184cb96310a05495c8 100644 (file)
@@ -252,7 +252,8 @@ typedef struct xc_hypercall_buffer xc_hypercall_buffer_t;
  * Set a xen_guest_handle in a type safe manner, ensuring that the
  * data pointer has been correctly allocated.
  */
-#define xc_set_xen_guest_handle(_hnd, _val)                                      \
+#undef set_xen_guest_handle
+#define set_xen_guest_handle(_hnd, _val)                                         \
     do {                                                                         \
         xc_hypercall_buffer_t _val1;                                             \
         typeof(XC__HYPERCALL_BUFFER_NAME(_val)) *_val2 = HYPERCALL_BUFFER(_val); \
@@ -260,7 +261,7 @@ typedef struct xc_hypercall_buffer xc_hypercall_buffer_t;
         set_xen_guest_handle_raw(_hnd, (_val2)->hbuf);                           \
     } while (0)
 
-/* Use with xc_set_xen_guest_handle in place of NULL */
+/* Use with set_xen_guest_handle in place of NULL */
 extern xc_hypercall_buffer_t XC__HYPERCALL_BUFFER_NAME(HYPERCALL_BUFFER_NULL);
 
 /*
index a4f7a95999ecd4486bf42a2a334357108d8aa17f..9953c802d1caa44da2c921f03f843f98cd69d834 100644 (file)
@@ -395,9 +395,9 @@ static void signal_int_handler(int signo)
         }
     }
 
-    xc_set_xen_guest_handle(info.cpu_to_core, cpu_to_core);
-    xc_set_xen_guest_handle(info.cpu_to_socket, cpu_to_socket);
-    xc_set_xen_guest_handle(info.cpu_to_node, cpu_to_node);
+    set_xen_guest_handle(info.cpu_to_core, cpu_to_core);
+    set_xen_guest_handle(info.cpu_to_socket, cpu_to_socket);
+    set_xen_guest_handle(info.cpu_to_node, cpu_to_node);
     info.max_cpu_index = MAX_NR_CPU - 1;
 
     ret = xc_topologyinfo(xc_handle, &info);
@@ -964,9 +964,9 @@ void cpu_topology_func(int argc, char *argv[])
        goto out;
     }
 
-    xc_set_xen_guest_handle(info.cpu_to_core, cpu_to_core);
-    xc_set_xen_guest_handle(info.cpu_to_socket, cpu_to_socket);
-    xc_set_xen_guest_handle(info.cpu_to_node, cpu_to_node);
+    set_xen_guest_handle(info.cpu_to_core, cpu_to_core);
+    set_xen_guest_handle(info.cpu_to_socket, cpu_to_socket);
+    set_xen_guest_handle(info.cpu_to_node, cpu_to_node);
     info.max_cpu_index = MAX_NR_CPU-1;
 
     if ( xc_topologyinfo(xc_handle, &info) )
index 61a0ac8b9201ccf5e6802d39e131349dc747dab5..832458de74dc67e6c764e7515265119faeab3f77 100644 (file)
@@ -53,7 +53,7 @@ static void *__getssid(xc_interface *xc_handle, int domid, uint32_t *buflen, xc_
     }
 
     memset(buf, 0, SSID_BUFFER_SIZE);
-    xc_set_xen_guest_handle(getssid.ssidbuf, buffer);
+    set_xen_guest_handle(getssid.ssidbuf, buffer);
     getssid.ssidbuf_size = SSID_BUFFER_SIZE;
     getssid.get_ssid_by = ACM_GETBY_domainid;
     getssid.id.domainid = domid;
@@ -254,10 +254,10 @@ static PyObject *chgpolicy(PyObject *self, PyObject *args)
     chgpolicy.delarray_size = del_arr_len;
     chgpolicy.chgarray_size = chg_arr_len;
     chgpolicy.errarray_size = sizeof(*error_array)*errarray_mbrs;
-    xc_set_xen_guest_handle(chgpolicy.policy_pushcache, bin_pol_buf);
-    xc_set_xen_guest_handle(chgpolicy.del_array, del_arr_buf);
-    xc_set_xen_guest_handle(chgpolicy.chg_array, chg_arr_buf);
-    xc_set_xen_guest_handle(chgpolicy.err_array, error_array);
+    set_xen_guest_handle(chgpolicy.policy_pushcache, bin_pol_buf);
+    set_xen_guest_handle(chgpolicy.del_array, del_arr_buf);
+    set_xen_guest_handle(chgpolicy.chg_array, chg_arr_buf);
+    set_xen_guest_handle(chgpolicy.err_array, error_array);
 
     rc = xc_acm_op(xc_handle, ACMOP_chgpolicy, &chgpolicy, sizeof(chgpolicy));
 
@@ -299,7 +299,7 @@ static PyObject *getpolicy(PyObject *self, PyObject *args)
        goto out;
 
     memset(&getpolicy, 0x0, sizeof(getpolicy));
-    xc_set_xen_guest_handle(getpolicy.pullcache, pull_buffer);
+    set_xen_guest_handle(getpolicy.pullcache, pull_buffer);
     getpolicy.pullcache_size = sizeof(pull_buffer);
 
     rc = xc_acm_op(xc_handle, ACMOP_getpolicy, &getpolicy, sizeof(getpolicy));
@@ -356,8 +356,8 @@ static PyObject *relabel_domains(PyObject *self, PyObject *args)
     reldoms.relabel_map_size = rel_rules_len;
     reldoms.errarray_size = sizeof(error_array);
 
-    xc_set_xen_guest_handle(reldoms.relabel_map, relabel_rules_buf);
-    xc_set_xen_guest_handle(reldoms.err_array, error_array);
+    set_xen_guest_handle(reldoms.relabel_map, relabel_rules_buf);
+    set_xen_guest_handle(reldoms.err_array, error_array);
 
     rc = xc_acm_op(xc_handle, ACMOP_relabeldoms, &reldoms, sizeof(reldoms));
 
index 9e8a5e4d97ef5189fd858f1cd7bcab9b1b0808e6..1c7a7ff9e5afdcd75a599013c367f952938f7ddf 100644 (file)
@@ -1219,9 +1219,9 @@ static PyObject *pyxc_topologyinfo(XcObject *self)
     if ( nodemap == NULL )
         goto out;
 
-    xc_set_xen_guest_handle(tinfo.cpu_to_core, coremap);
-    xc_set_xen_guest_handle(tinfo.cpu_to_socket, socketmap);
-    xc_set_xen_guest_handle(tinfo.cpu_to_node, nodemap);
+    set_xen_guest_handle(tinfo.cpu_to_core, coremap);
+    set_xen_guest_handle(tinfo.cpu_to_socket, socketmap);
+    set_xen_guest_handle(tinfo.cpu_to_node, nodemap);
     tinfo.max_cpu_index = MAX_CPU_INDEX;
 
     if ( xc_topologyinfo(self->xc_handle, &tinfo) != 0 )
@@ -1313,9 +1313,9 @@ static PyObject *pyxc_numainfo(XcObject *self)
     if ( nodes_dist == NULL )
         goto out;
 
-    xc_set_xen_guest_handle(ninfo.node_to_memsize, node_memsize);
-    xc_set_xen_guest_handle(ninfo.node_to_memfree, node_memfree);
-    xc_set_xen_guest_handle(ninfo.node_to_node_distance, nodes_dist);
+    set_xen_guest_handle(ninfo.node_to_memsize, node_memsize);
+    set_xen_guest_handle(ninfo.node_to_memfree, node_memfree);
+    set_xen_guest_handle(ninfo.node_to_node_distance, nodes_dist);
     ninfo.max_node_index = MAX_NODE_INDEX;
 
     if ( xc_numainfo(self->xc_handle, &ninfo) != 0 )
index dfd70f54f8ab0335e13e01a83a9524c2702874e4..bc85a93e928461747ad9ef0f4fff07b54d6d1d5e 100644 (file)
@@ -248,7 +248,7 @@ int acm_get_ssidref(xc_interface *xc_handle, int domid, uint16_t *chwall_ref,
     ssid = xc_hypercall_buffer_alloc(xc_handle, ssid, ssid_buffer_size);
     if ( ssid == NULL )
         return 1;
-    xc_set_xen_guest_handle(getssid.ssidbuf, ssid);
+    set_xen_guest_handle(getssid.ssidbuf, ssid);
     getssid.ssidbuf_size = ssid_buffer_size;
     getssid.get_ssid_by = ACM_GETBY_domainid;
     getssid.id.domainid = domid;
@@ -276,7 +276,7 @@ int acm_domain_getpolicy(xc_interface *xc_handle)
         return -1;
 
     memset(pull_buffer, 0x00, pull_cache_size);
-    xc_set_xen_guest_handle(getpolicy.pullcache, pull_buffer);
+    set_xen_guest_handle(getpolicy.pullcache, pull_buffer);
     getpolicy.pullcache_size = pull_cache_size;
     ret = xc_acm_op(xc_handle, ACMOP_getpolicy, &getpolicy, sizeof(getpolicy));
     if (ret >= 0) {
@@ -389,7 +389,7 @@ int acm_domain_loadpolicy(xc_interface *xc_handle, const char *filename)
 
     /* dump it and then push it down into xen/acm */
     acm_dump_policy_buffer(buffer, len, chwall_ssidref, ste_ssidref);
-    xc_set_xen_guest_handle(setpolicy.pushcache, buffer);
+    set_xen_guest_handle(setpolicy.pushcache, buffer);
     setpolicy.pushcache_size = len;
     ret = xc_acm_op(xc_handle, ACMOP_setpolicy, &setpolicy, sizeof(setpolicy));
 
@@ -437,7 +437,7 @@ int acm_domain_dumpstats(xc_interface *xc_handle)
         return -1;
 
     memset(stats_buffer, 0x00, pull_stats_size);
-    xc_set_xen_guest_handle(dumpstats.pullcache, stats_buffer);
+    set_xen_guest_handle(dumpstats.pullcache, stats_buffer);
     dumpstats.pullcache_size = pull_stats_size;
     ret = xc_acm_op(xc_handle, ACMOP_dumpstats, &dumpstats, sizeof(dumpstats));